USE [{0}]

SELECT 
	COL_NAME(fc.parent_object_id, fc.parent_column_id) AS [BASE_COLUMN_NAME],
	O.[name] AS [BASE_TABLE_NAME],
	refSchema.[name] AS REFERENCED_SCHEMA_NAME,
	RefT.[name] AS REFERENCED_TABLE_NAME,
	OPK.[name] AS REFERENCED_PK_NAME,
	ICU.[COLUMN_NAME] AS REFERENCED_COLUMN_NAME,
	FK.delete_referential_action AS DELETE_RULE_CODE,
	FK.update_referential_action AS UPDATE_RULE_CODE,
	FK.[name] AS FK_NAME
FROM INFORMATION_SCHEMA.TABLES IT
	INNER JOIN sys.objects O
	ON O.[name] = IT.[TABLE_NAME] AND O.[type] = 'U'
	INNER JOIN sys.foreign_keys FK
	ON FK.parent_object_id =O.object_id
	INNER JOIN sys.tables RefT
	ON RefT.object_id = FK.referenced_object_id
	INNER JOIN sys.objects OPK
	ON OPK.parent_object_id = RefT.object_id AND OPK.[type] = 'PK'
	INNER JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ICU
	ON ICU.[CONSTRAINT_NAME] = OPK.[name]
	INNER JOIN sys.schemas refSchema
	ON refSchema.schema_id = RefT.schema_id
	INNER JOIN sys.foreign_key_columns AS fc
	ON fc.constraint_object_id = FK.OBJECT_ID
WHERE IT.[TABLE_NAME] = '{1}'
